package com.tom.architect02.ui10.day10;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;


/**
 * Added by Tom on 2024/06/07.
 */
public class TouchView extends View {

    public TouchView(Context context) {
        this(context, null);
    }

    public TouchView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TouchView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.e("TAG0607", "onTouchEvent-- " + event.getAction());
        return super.onTouchEvent(event); // 让父类的onTouchEvent 得到执行
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        super.dispatchTouchEvent(event); // 执行父类的方法。分发事件。
        return true;
//        return super.dispatchTouchEvent(event);
    }
}
